package com.hanxiaozhang.system.dao;

import com.hanxiaozhang.system.entity.JobEntity;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 岗位表
 *
 * @author hanxiaozhang
 * @email hanxiaozhang2018@sina.com
 * @date 2021-03-30
 */
@Mapper
public interface JobDao {

	JobEntity get(Long jobId);
	
	List<JobEntity> list(Map<String, Object> map);

	int save(JobEntity job);
	
	int update(JobEntity job);
	
	int remove(Long jobId);

	int batchRemove(Long[] jobIds);

	List<JobEntity> listByJobIds(@Param("jobIds")  List<Long> jobIds);


	/**
	 * 通过岗位名称获取实体
	 *
	 * @param jobName
	 * @return
	 */
	@Select("select * from `sys_job` where   `del_flag` = 0 and  `job_name` = #{jobName}")
	JobEntity getByJobName(@Param("jobName") String jobName);

	/**
	 * 通过岗位名称和岗位Id获取实体
	 *
	 * @param jobName
	 * @param jobId
	 * @return
	 */
	@Select("select * from `sys_job` where   `del_flag` = 0  and  `job_name` = #{jobName} and  `job_id` != #{jobId}")
	JobEntity getByJobNameAndNoJobId(@Param("jobName") String jobName,@Param("jobId") Long jobId);

}
